

<?php 
$pageTitle = "Register";
include_once "common/header.php"; 
?>
<link rel="stylesheet" type="text/css" href="css/themes/account_setup_page.css" >
	<?php 
	if(isset($_GET['v']) && isset($_GET['e'])):
    
        include_once "common/inc/class.users.inc.php";
        $users = new GenericUser($db);
        $ret = $users->verifyAccount();
		
    
	
	elseif(!empty($_POST['firstname']) && !empty($_POST['lastname']) && $_FILES['image_file']['error']==0):
        include_once "common/inc/class.users.inc.php";
        $users = new GenericUser($db);
        echo $users->createProfile();
		exit;
	 
	 else:
        header("Location: signup.php");
        endif;
    
    if($ret[0]==0):

	?>
	 <link href="css/jcrop/jquery.Jcrop.min.css" rel="stylesheet" type="text/css" />

        <!-- add scripts -->
		<script src="scripts/jcrop/jquery.min.js"></script>
        <script src="scripts/jcrop/jquery.Jcrop.min.js"></script>
        <script src="scripts/jcrop/script.js"></script>
		
    <article id="signup_container">
		<form enctype="multipart/form-data"  method="post" action="account_setup.php" id="signup">
			<h1>Setup your account!</h1>
			  <input type="hidden" id="x1" name="x1" />
                    <input type="hidden" id="y1" name="y1" />
                    <input type="hidden" id="x2" name="x2" />
                    <input type="hidden" id="y2" name="y2" />
					<input type="hidden" id="w" name="w" />
                    <input type="hidden" id="h" name="h" />
			<input class="textfield" type="text" placeholder="First Name" required="" name = "firstname">
			<input class="textfield" type="text" placeholder="Last Name" required="" name = "lastname">
			<input type="hidden" name="v" value="<?php echo $_GET['v'] ?>" />
			<div class="radio">  
				<h2>Gender:</h2>
				<input id="male" type="radio" name="gender" value="male">  
				<label for="male">Male</label>  
				<input id="female" type="radio" name="gender" value="female">  
				<label for="female">Female</label>  
			</div>  
			<div class="checkbox"> 
				<h2>User Category:</h2>
				<input id="artist" type="checkbox" name="check" value="artist">  
				<label for="artist">Artist</label>  
				<input id="writer" type="checkbox" name="check" value="writer">  
				<label for="writer">Writer</label>  
				<input id="reader" type="checkbox" name="check" value="reader">  
				<label for="reader">Reader</label>  
				<br>  
			</div>  
			<div class ="thumb">
				<h2>Choose user thumbnail:</h2>
                    <div><input type="file" name="image_file" id="image_file" onchange="fileSelectHandler()" /></div
                    <div class="error"></div>

                    <div class="step2">
                       
                        <img id="preview" />
                       
                    </div>
                
			</div>
			<button type="submit">Finished!</button>	
		</form>
            	
               
    </article>
      
</body>

<?php
    endif;
    
?>
</html>
